***Reaching Out to the Voter? Campaigning on Twitter During the 2019 European Elections***

***Table 1***
use "C:\Replication\R&P replication data2.dta", clear
xtmixed tweets_base citizens_rep pref_vote avg_dm pref_dm March_safety seatshare government ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_base ep_seniority age female ep_leadership vchair epg_no2 epg_no3 epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 epg_no9 || ms_code:, robust cluster(ms_code)
outreg2 using twitter3_1.xls, label ctitle("Model I","base") onecol dec(3) replace
xtmixed tminus2m citizens_rep pref_vote avg_dm pref_dm March_safety seatshare government ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_tminus2m ep_seniority age female ep_leadership vchair epg_no2 epg_no3 epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 epg_no9 || ms_code:, robust cluster(ms_code)
outreg2 using twitter3_1.xls, append label ctitle("Model II","T-2m") onecol dec(3) 
xtmixed tminus1m citizens_rep pref_vote avg_dm pref_dm April_safety seatshare government ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_tminus1m ep_seniority age female ep_leadership vchair epg_no2 epg_no3 epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 epg_no9 || ms_code:, robust cluster(ms_code)
outreg2 using twitter3_1.xls, append label ctitle("Model III","T-1m") onecol dec(3) 
xtmixed tminus1w_combined citizens_rep pref_vote avg_dm pref_dm May_safety seatshare government ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_tminus1w_com ep_seniority age female ep_leadership vchair epg_no2 epg_no3 epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 epg_no9 || ms_code:, robust cluster(ms_code)
outreg2 using twitter3_1.xls, append label ctitle("Model IV","T-1w") onecol dec(3) 
xtmixed tplus1m citizens_rep pref_vote avg_dm pref_dm May_safety seatshare government ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_tplus1m ep_seniority age female ep_leadership vchair epg_no2 epg_no3 epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 epg_no9 || ms_code:, robust cluster(ms_code)
outreg2 using twitter3_1.xls, append label ctitle("Model V","T+1m") onecol dec(3) 
*Table manually edited*

***Figure 1***
use "C:\Replication\R&P replication data2.dta", clear
rename tminus1w_combined twitter_lastweek
rename citizens_rep tthcitizenMEP 
label variable tthcitizenMEP "H1. Citizens Represented"
rename pref_vote EP_prefvote 
label variable EP_prefvote "H2. Preferential Vote"
rename avg_dm avg_dm2 
label variable avg_dm2 "H2. Avg. District Magnitude"
rename pref_dm pref_dm2
label variable pref_dm2 "H2. Pref. Vote X Avg. DM"
rename May_safety list_safety_may 
label variable list_safety_may "H3. List Safety"
rename seatshare natl_parl_partyseatshare 
label variable natl_parl_partyseatshare "H4. National Party Seat Share"
rename government natl_gov 
label variable natl_gov "H4. National Party in Gov't"

xtmixed twitter_lastweek tthcitizenMEP EP_prefvote avg_dm2 pref_dm2 list_safety_may natl_parl_partyseatshare natl_gov ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_tminus1w_com ep_seniority age female ep_leadership vchair epg_no2 epg_no3 epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 epg_no9 || ms_code:, robust cluster(ms_code)
estimates store F

use "C:\Replication\eup-15-1082-File005.dta", clear
label variable tthcitizenMEP "H1. Citizens Represented"
label variable EP_prefvote "H2. Preferential Vote"
label variable avg_dm2 "H2. Avg. District Magnitude"
label variable pref_dm2 "H2. Pref. Vote X Avg. DM"
label variable list_safety_may "H3. List Safety"
label variable natl_parl_partyseatshare "H4. National Party Seat Share"
label variable natl_gov "H4. National Party in Gov't"

xtmixed twitter_lastweek tthcitizenMEP EP_prefvote avg_dm2 pref_dm2 list_safety_may natl_parl_partyseatshare natl_gov mean_age RegSocialMedia internet_user ext_lr ext_galtan ext_integ followers_may terms_served age female EP_leader leadership EPP PES ALDE Verts GUE_NGL EFD ECR || country_code:, robust cluster(country_code)
estimates store D

coefplot D, bylabel(2014 Election) ///
       || F, bylabel(2019 Election)  ///
       ||, keep(tthcitizenMEP EP_prefvote avg_dm2 pref_dm2 list_safety_may natl_parl_partyseatshare natl_gov) xline(0)
*Figure manually edited in Graph editor*

***Table 2***
use "C:\Replication\R&P replication data2.dta", clear
drop if epg_no2==1
drop if epg_no3==1
drop if epg_no9==1
xtmelogit ownlead_tm2m_bi citizens_rep pref_vote avg_dm pref_dm March_safety seatshare government ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_tminus2m ep_seniority age female ep_leadership vchair epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 || ms_code:
outreg2 using twitter3_2.xls, label ctitle("Model I","T-2m") onecol dec(3) replace
xtmelogit ownlead_tm1m_bi citizens_rep pref_vote avg_dm pref_dm April_safety seatshare government ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_tminus1m ep_seniority age female ep_leadership vchair epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 || ms_code:
outreg2 using twitter3_2.xls, append label ctitle("Model II","T-1m") onecol dec(3) 
xtmelogit ownlead_tm1w_com_bi citizens_rep pref_vote avg_dm pref_dm May_safety seatshare government ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_tminus1w_com ep_seniority age female ep_leadership vchair epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 || ms_code:
outreg2 using twitter3_2.xls, append label ctitle("Model III","T-1w") onecol dec(3) 
xtmelogit ownlead_tp1m_bi citizens_rep pref_vote avg_dm pref_dm May_safety seatshare government ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_tplus1m ep_seniority age female ep_leadership vchair epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 || ms_code:
outreg2 using twitter3_2.xls, append label ctitle("Model IV","T+1m") onecol dec(3) 
*Table manually edited*

***Figure 2***
use "C:\Replication\R&P replication data2.dta", clear
drop if epg_no2==1
drop if epg_no3==1
drop if epg_no9==1
xtmelogit ownlead_tm1w_com_bi citizens_rep i.pref_vote##c.avg_dm May_safety seatshare government ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_tminus1w_com ep_seniority age female ep_leadership vchair epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 || ms_code:
margins, at(avg_dm=(3 (5) 74) pref_vote=(0 1)) predict(mu fixedonly) atmeans
marginsplot, recast(line) recastci(rarea) xlabels(0 (5) 75) plot1opts(lpattern(dash) lcolor(black)) plot2opts(lcolor(black)) xtitle("Average district magnitude") ytitle("Predicted marginal means") legend(label(1 "Preferential Voting Systems") label(2 "Non-Preferential Voting Systems"))
*Figure manually edited in Graph editor*

***Figure 3***
use "C:\Replication\R&P replication data2.dta", clear
keep if epg_no6==1 
gen total_mentions =ownlead_tm2m+ownlead_tm1m
graph bar (mean) total_mentions, over(ms) ytitle("Mean number of mentions") title("EPP: Average of mentions during two-month campaign")
*Figure manually edited in Graph editor*

***Figure 4***
use "C:\Replication\R&P replication data2.dta", clear
keep if epg_no8==1 
gen total_mentions =ownlead_tm2m+ownlead_tm1m
graph bar (mean) total_mentions, over(ms) ytitle("Mean number of mentions") title("S&D: Average of mentions during two-month campaign")
*Figure manually edited in Graph editor*

***Appendix A***
use "C:\Replication\R&P replication data2.dta", clear
drop if ms=="Great Britain"
drop if ms=="Northern Ireland"
xtmixed tminus1w_combined citizens_rep pref_vote avg_dm pref_dm May_safety seatshare government ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_tminus1w_com ep_seniority age female ep_leadership vchair epg_no2 epg_no3 epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 epg_no9 || ms_code:, robust cluster(ms_code)
outreg2 using twitter3_A.xls, label ctitle("Model IV","T-1 week") onecol dec(3) replace
xtmixed tplus1m citizens_rep pref_vote avg_dm pref_dm May_safety seatshare government ms_social_network lrgen_w_x galtan_w_x eu_position_w_x followers_tplus1m ep_seniority age female ep_leadership vchair epg_no2 epg_no3 epg_no4 epg_no5 epg_no6 epg_no7 epg_no8 epg_no9 || ms_code:, robust cluster(ms_code)
outreg2 using twitter3_A.xls, append label ctitle("Model V","T+1 month") onecol dec(3) 
*Table manually edited*
